package Assignment;

import java.util.Random;
import java.util.Scanner;

//键盘输入任意字符串，打乱里面的内容
public class Test1 {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入字符串");
        String str = scanner.next();

        System.out.println(disorganize(str));
    }
    public static String disorganize(String str){
        char[] arr = str.toCharArray();

        Random random = new Random();

        for (int i = 0; i < arr.length; i++) {
            int index = random.nextInt(arr.length);
            char temp = arr[i];
            arr[i] = arr[index];
            arr[index] = temp;

        }
        return new String(arr);
    }
}
